<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script>
        //通过new创建数组
        var arr = new Array();
        //利用数组字面量创建数组
        var arr = []; //创建了一个空数组

        var arr = [1, 100, 'pink', true];
        console.log(arr);
        console.log(arr[2]);

        //遍历数组
        for (var i = 0; i < arr.length; i++) {
            console.log(arr[i]);
        }
        //获取数组长度
        console.log(arr.length);

        //数组转换为字符串
        var arr = ['red', 'green', 'blue', 'pink'];
        var str = '';
        for (var i = 0; i < arr.length; i++){
            str+=arr[i]+'|'
        }
        console.log(str);
        

    </script>
</head>

<body>

</body>

</html>